<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>学习绝对定位</title>
    <style>
        /* 外部容器，设置相对定位 */
        .container {
            position: relative;
            width: 400px;
            height: 300px;
            background-color: #f0f0f0;
            border: 2px solid #ccc;
            margin: 50px auto;
        }

        /* 绝对定位的元素 */
        .box {
            position: absolute;
            width: 100px;
            height: 100px;
            background-color: #4caf50;
            color: white;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 14px;
            font-family: Arial, sans-serif;
        }

        /* 四个不同的定位 */
        .top-left {
            top: 10px;
            left: 10px;
        }

        .top-right {
            top: 10px;
            right: 10px;
        }

        .bottom-left {
            bottom: 10px;
            left: 10px;
        }

        .bottom-right {
            bottom: 10px;
            right: 10px;
        }
    </style>
</head>
<body>
<div class="container">
    <div class="box top-left">左上角</div>
    <div class="box top-right">右上角</div>
    <div class="box bottom-left">左下角</div>
    <div class="box bottom-right">右下角</div>
</div>
</body>
</html>
